<template>
	<view class="box">
		<view class="uni-list">
			<view class="uni-list-cell" hover-class="uni-list-cell-hover" v-for="item in addressList" :key="item.address_id" @tap="toOrder(item)">
				<view class="uni-media-list uni-pull-right">
					<view class="uni-media-list-logo" style="display: flex;align-items: center;justify-content: center;">
					</view>
					<view class="uni-media-list-body">
						<view class="uni-media-list-text-top">{{item.true_name}}  {{item.mod_phone}}</view>
						<view class="uni-media-list-text-bottom uni-ellipsis">{{item.address}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script> 
	import {
		addressList,
	} from '../../common/api.js'
export default{
	data(){
		return{
			userInfo: this.$store.state.userInfo,
			addressList: [], // 地址列表
			addressInfo: {}, //单个地址信息
		}
	},
	methods:{
		handleAddressList(){
			let reqData = {
				user_token: this.userInfo.user_token
			}
			addressList(reqData).then( res => {
				console.log(res.data)
				let resData = res.data
				this.addressList = resData.result
				
			})
		},
		toOrder(val){
			console.log(val)
			this.$store.commit('setAddressInfo', val)
			uni.redirectTo({
				url:'../order/order'
			})
		},
	},
	onShow() {
		this.handleAddressList()
	}
}
</script>

<style>
	@import "../../common/uni.css";
	
</style>